package cn.nfwx.tv.adapter;

import android.content.Context;
import android.os.Parcelable;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import cn.nfwx.tv.R;
import cn.nfwx.tv.model.TvChannel;
import cn.nfwx.tv.util.GlideUtil;

/**
 * Created by zb.liu on 2017/11/1.
 */

public class HotChannelAdapter extends BaseQuickAdapter<Parcelable, BaseViewHolder> {
    public HotChannelAdapter(Context context) {
        super(R.layout.fragment_hotchannel_item);
        this.mContext = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, Parcelable parcelable) {
        if (parcelable instanceof TvChannel) {
            TvChannel item = (TvChannel) parcelable;
            GlideUtil.loadRoundImage(helper.itemView.getContext(), item.getLogo(), (ImageView) helper.getView(R.id.iv_item_hot_channel));
            helper.setText(R.id.tv_item_hot_channel, item.getName());
        }
    }
}
